var activePage = "composition";
$(document).ready(function() {
    $('#task-list').accordion();
});

function createTaskDialog() {
    $.blockUI(blockUIConfig);
    var dialog = $('<div></div').load('createTaskDialog', function() {
        $.unblockUI();
        $(this).dialog(jQueryDialogConfig('Create Task',300,500));
        $('#create-task-form').validate();
        $('button').button();
    });
}

function choosePluginDialog() {
    $.blockUI(blockUIConfig);
    $('<div></div').load('choosePluginDialog', function() {
        $.unblockUI();
        $(this).dialog(jQueryDialogConfig('Create Plugin',150,500));
        $('button').button();
    });
}

function setupPluginDialog(form) {
    var pluginCords = form.elements[0].value.split('::');
    $('#choose-plugin-spinner').show();
    $('#pluginParametersContainer').load('setupPluginDialog',{
        groupId : pluginCords[1],
        pluginId  : pluginCords[0],
        version  : pluginCords[2]}, function(data) {
            $('button').button();
            $('#pluginParametersForm').validate();
            $('#choose-plugin-spinner').hide();
        }
    );
}

function pluginPropertiesDialog(instanceId) {
    $.blockUI(blockUIConfig);
    $('<div></div').load('pluginPropertiesDialog', {instanceId:instanceId},
        function(data) {
            $.unblockUI();
            $(this).dialog(jQueryDialogConfig('Plugin Properties',200,500));
        }
    );
}

function createConnectionDialog() {
    $.blockUI(blockUIConfig);
    $('<div></div').load('createConnectionDialog', function() {
        $.unblockUI();
        $(this).dialog(jQueryDialogConfig('Create Connection',200,500));
        $('button').button();
    });
}
